package cn.uniqueinfo.dp.filter;

import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * @author:朱元勋
 * @mail:395910063@qq.com
 * @date:2019-01-05 16:05:45
 * @description:
 */
@Slf4j
public class AuthenticationFilter extends FormAuthenticationFilter {
    @Override
    protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest request, ServletResponse response) throws Exception {
        log.warn("重定向");
        String successUrl = "/main/index";
        WebUtils.issueRedirect(request,response,successUrl);
        return false;
    }

}
